<template>
  <div class="codegen-container">
    <h2>代码生成</h2>
    <a-form layout="vertical">
      <a-form-item label="需求描述">
        <a-textarea v-model="requirement" :rows="4" />
      </a-form-item>
      <a-form-item>
        <a-button type="primary" @click="generateCode">生成代码</a-button>
      </a-form-item>
    </a-form>
    <a-card v-if="generatedCode">
      <pre>{{ generatedCode }}</pre>
    </a-card>
  </div>
</template>

<script>
export default {
  name: 'CodeGen',
  data() {
    return {
      requirement: '',
      generatedCode: ''
    }
  },
  methods: {
    generateCode() {
      // 模拟代码生成
      this.generatedCode = '// 这里是生成的代码\nfunction example() {\n  console.log("Hello");\n}'
    }
  }
}
</script> 